import request from "./request";

export class RequserMethods {
  /**
   *  url 路径
   * params  参数
   */
  static get = (url: string, params?: any): Promise<any> => {
    return new Promise((resolve, reject) => {
      request
        .get(url, { params })
        .then((res: any) => {
          resolve(res);
        })
        .catch((err) => {
          reject(err);
        });
    });
  };
  static post = <T>(url: string, params?: T): Promise<any> => {
    return new Promise((resolve, reject) => {
      request
        .post(url, { ...params })
        .then((res) => {
          resolve(res);
        })
        .catch((err) => {
          reject(err);
        });
    });
  };
}
